﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="_20200304lianxi2.index" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>验证</title>
   
    
</head>
<body>
    <script type="text/javascript">
        function IsEven(source, args) {
            if (args.Value % 2 == 0) {
                arg.IsValid = true;
            }
            else {
                args.IsValid = false;
            }
        }
    </script>

    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td>用&nbsp; 户&nbsp; 名：</td>
                <td><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="姓名不能为空" ControlToValidate="TextBox1" ForeColor="Red"></asp:RequiredFieldValidator></td>
            </tr>
            
            <tr>
                <td>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 码：</td>
                <td><asp:TextBox ID="TextBox3" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="密码不能为空" ControlToValidate="TextBox3" ForeColor="Red"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td>确认密码：</td>
                <td><asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="确认密码不能为空" ControlToValidate="TextBox4" ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox3" ControlToValidate="TextBox4" ErrorMessage="两次密码不一致" ForeColor="Red"></asp:CompareValidator>
                </td>
            </tr>
            <tr>
                <td>金&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 额：</td>
                <td><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="金额不能为空" ControlToValidate="TextBox2" ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="输入金额只能只能是1-100之间" ControlToValidate="TextBox2" ForeColor="Red" MaximumValue="100" MinimumValue="1" Type="Integer"></asp:RangeValidator>
                </td>
            </tr>
            <tr>
                <td>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 箱：</td>
                <td><asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="邮箱不能为空" ControlToValidate="TextBox5" ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox5" ErrorMessage="邮箱格式不符" ForeColor="Red" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td>偶&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 数：</td>
                <td><asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="不能为空" ControlToValidate="TextBox6" ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="不是一个偶数" ClientValidationFunction="IsEven" ForeColor="Red" ControlToValidate="TextBox6"></asp:CustomValidator>
                </td>
            </tr>
        </table>
        <asp:Button ID="Button1" runat="server" Text="确定"></asp:Button>
        <br />
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" ForeColor="Red" />
    </div>
    </form>
</body>
</html>
